package com.ssy.lingxi.after.sale.repository;

import com.ssy.lingxi.after.sale.entity.ReturnGoodsDetailAssociatedDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 退货物料
 * @author ds
 * @date 2020/4/30
 * @version 2.0.0
 */
public interface ReturnGoodsDetailMaterielRepository extends JpaRepository<ReturnGoodsDetailAssociatedDO, Long>, JpaSpecificationExecutor<ReturnGoodsDetailAssociatedDO> {

    /**
     * 根据退货id删除退货物料
     * @author ds
     * @date 2020/4/30
     * @param returnId:
     * @return void
     **/
    @Transactional
    void deleteAllByReturnId(Long returnId);

    /**
     * 根据退货id查询所有退货物料
     * @author ds
     * @date 2020/4/30
     * @param returnId:
     * @return List<ReturnGoodsDetailMaterielDO>
     **/
    List<ReturnGoodsDetailAssociatedDO> findByReturnId(Long returnId);
    /**
     * 根据退货详情id查询所有退货物料
     * @author ds
     * @date 2020/4/30
     * @param returnDetailIds:
     * @return List<ReturnGoodsDetailMaterielDO>
     **/
    List<ReturnGoodsDetailAssociatedDO> findAllByReturnDetailIdIn(List<Long> returnDetailIds);

}
